package com.shaoshaohuo.app.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by Administrator on 2017/6/5.
 */

public class HomeTabLayoutAdapter extends FragmentPagerAdapter {
    private Context context;
    private List<String> tab_data;
    private List<Fragment> tab_fragment;

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        super.destroyItem(container, position, object);
    }

    public HomeTabLayoutAdapter(FragmentManager fm, Context context, List<String> tab_data, List<Fragment> tab_fragment) {
        super(fm);
        this.context = context;
        this.tab_data = tab_data;
        this.tab_fragment = tab_fragment;
    }

    @Override
    public Fragment getItem(int i) {
        return tab_fragment.get(i);
    }

    @Override
    public int getCount() {
        return tab_data.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tab_data.get(position);
    }
}
